# -*- coding: utf-8 -*-
# File : utils.py
# Author: taoyahui
# Date : 2021/4/8
import time

# 判断输入的key值是否在字典中
def has_keys(dic, *keys):
    for k in keys:
        if k not in dic.keys():
            return False
    return True


# 以加密的方式生成token
def gen_token():
    import random  # 引入random包，用于生成随机字符串
    import hashlib  # 引入包，用于生成对应的md5码
    # 生成源字符串
    src = ''.join(random.sample('abcdefghijklmnopqrstuvwxyz!@#$%^&*()', 20))
    m2 = hashlib.md5()
    m2.update(src.encode("utf8"))  # 生成经过md5加密的字符串
    return m2.hexdigest()  # 返回


def get_time_int():
    return int(time.time())

if __name__ == '__main__':
    print(get_time_int())